export let methods={
    created:function(){
        console.log('mixin created')
        this.initData();
    },
    methods:{
        initData:function(){
        //let url ='https://question.llblog.cc/';
        let url ='https://question.llblog.cc/api.php';//做了跨域处理的
        //methos get post delete patch
        this.$axios.get(url).then(res=>{
           this.products=res.data.data;
           console.log(this.products)
          });
        }
    },
    mounted:function(){
        this.$bus.$on('confirmOder',(id,num)=>{
            console.log('adv 收到change');
           this.products.forEach(el=>{
               if(el.id==id){
                   el.num = el.num-num;
               }
           })
        })
    },
}


export const data={
    data:function(){
     return {
        title:'实训项目',
        price:100,
        num:10
     }
    }
    
}

